home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / METAKIT.ZIP / EXAMPLES / CATFISH / CATFISH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-09  |  3.9 KB  |  138 lines

  1. //  catfish.h  -  main application sample code
  2. //
  3. //  This is a part of the MetaKit library.
  4. //  Copyright (c) 1996 Meta Four Software.
  5. //  All rights reserved.
  6. /////////////////////////////////////////////////////////////////////////////
  7.  
  8. #ifndef __AFXWIN_H__
  9.     #error include 'stdafx.h' before including this file for PCH
  10. #endif
  11.  
  12. #include "resource.h"       // main symbols
  13. #include "finddlg.h"
  14.  
  15. #define FILE_TYPE   ".cf4"
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19.     extern CString GetCatalogDate(CString& catName);
  20.     
  21. /////////////////////////////////////////////////////////////////////////////
  22. // The main application class
  23.  
  24. class CTheApp : public CWinApp
  25. {
  26. public:
  27.     CTheApp ();
  28.     
  29.     virtual BOOL InitInstance();
  30.     virtual BOOL ProcessMessageFilter(int code, LPMSG lpMsg);
  31. };
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // The main dialog window class
  35.  
  36. class CMainDlgWindow : public CDialog
  37. {
  38. private:
  39.         // a small font used for several dialog box items
  40.     CFont m_font;
  41.       
  42.         // these are set during listbox owner-draw
  43.     DRAWITEMSTRUCT* m_item;
  44.     CDC* m_dc;
  45.     
  46.         // set to the current catalog
  47.     c4_Storage* m_storage;
  48.     c4_View m_currCat;
  49.     CString m_currCatName;
  50.     
  51.         // the directory currently shown in the tree list
  52.     int m_treeDir;
  53.     
  54.         // the directory currently shown in the file list
  55.     int m_fileDir;
  56.     c4_View m_fileView;
  57.     c4_View m_fileSort;
  58.  
  59.         // cumulative totals, one entry for each directory in the catalog
  60.     CWordArray m_dirCounts;
  61.     CWordArray m_fileCounts;
  62.     CWordArray m_lastDates;
  63.     CDWordArray m_kiloTotals;
  64.     
  65.         // the find dialog is a member so it can remember the current settings
  66.     CFindDialog m_findDlg;
  67.     
  68.         // sort order of the file list
  69.     c4_Property* m_sortProp;
  70.     bool m_sortReverse; 
  71.  
  72.     void ConstructTitle();
  73.  
  74.     void SetCatalog(const char* catName);
  75.     void SetTreeDir(int dirNum);           
  76.     void SetFileDir(int dirNum);           
  77.     
  78.     void DrawItemText(const CString& text, int off =0);
  79.     void OnDrawCatItem(int n);
  80.     void OnDrawDirItem(int n);
  81.     void OnDrawFileItem(int n);
  82.  
  83.     void AdjustDisplay(CCmdUI&, int, c4_Property&, int, const char*);
  84.     void SortFileList(c4_Property& prop_, bool toggle_ =false);
  85.  
  86. public:
  87.     CMainDlgWindow ();
  88.     ~CMainDlgWindow ();
  89.  
  90.     //{{AFX_DATA(CMainDlgWindow)
  91.     enum { IDD = IDD_MAIN_DIALOG };
  92.     CButton m_findBtn;
  93.     CStatic m_pathFrame;
  94.     CListBox    m_treeList;
  95.     CListBox    m_fileList;
  96.     CListBox    m_catList;
  97.     CStatic m_msgText;
  98.     CStatic m_infoText;
  99.     CStatic m_treePath;
  100.     //}}AFX_DATA
  101.  
  102.     //{{AFX_VIRTUAL(CMainDlgWindow)
  103.     virtual void DoDataExchange(CDataExchange* pDX);
  104.     //}}AFX_VIRTUAL
  105.  
  106.     virtual void OnCancel();
  107.  
  108. protected:
  109.     //{{AFX_MSG(CMainDlgWindow)
  110.     virtual BOOL OnInitDialog();
  111.     afx_msg void OnClose();
  112.     afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
  113.     afx_msg void OnSelchangeCatList();
  114.     afx_msg void OnSelchangeTreeList();
  115.     afx_msg void OnDblclkTreeList();
  116.     afx_msg void OnSelchangeFileList();
  117.     afx_msg void OnFindBtn();
  118.     afx_msg void OnSetupBtn();
  119.     afx_msg void OnDblclkFileList();
  120.     afx_msg void OnFindNext();
  121.     afx_msg void OnFindPrev();
  122.     afx_msg void OnSortByName();
  123.     afx_msg void OnSortBySize();
  124.     afx_msg void OnSortByDate();
  125.     afx_msg void OnSortReverse();
  126.     afx_msg void OnDestroy();
  127.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  128.     afx_msg void OnAppAbout();
  129.     //}}AFX_MSG
  130.     afx_msg void OnHelp();
  131.     DECLARE_MESSAGE_MAP()
  132.     
  133.     friend class CFindState;
  134. };
  135.  
  136. /////////////////////////////////////////////////////////////////////////////
  137. // $Id: catfish.h,v 1.2 1996/12/04 14:49:25 jcw Exp $
  138.